<!DOCTYPE html>
<html>
<head>   
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>用户管理</title>
    <meta name="keywords" content="用户管理">
    <meta name="description" content="用户管理">
    <link rel="shortcut icon" href="favicon.ico">
    <link href="__ADMIN__css/bootstrap.min.css" rel="stylesheet">
    <link href="__ADMIN__css/font-awesome.min.css" rel="stylesheet">
    <link href="__ADMIN__css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="__ADMIN__css/animate.css" rel="stylesheet">
    <link href="__ADMIN__css/style.css" rel="stylesheet">
    <link href="__ADMIN__js/plugins/layer/skin/default/layer.css" rel="stylesheet">
    <link href="__ADMIN__js/plugins/layer/laypage/skin/laypage.css" rel="stylesheet">
</head>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>权限列表</h5>
                </div>
                <div class="ibox-content">
                    <div class="row">
                        <div class="col-sm-4">
                            <div class="input-group">
                                <a href="{:U('Rule/add')}" class="btn btn-outline btn-primary ">添加权限</a>
                            </div>
                        </div>
                    </div>
                    <div class="hr-line-dashed" style="margin: 10px"></div>
                    <div class="table-responsive">
                        <table class="table table-bordered">
                            <thead>
                            <tr>
                                <th>ID</th>
                                <th>权限名称</th>
                                <th>节点名称</th>
                                <th>权限状态</th>
                                <th>添加时间</th>
                                <th>排序</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody id="show">
                                <!-- tp用volist俩循环输出从数据库读出的内容 -->
                                <volist name="rlist" id="vs">
                                    <tr>
                                        <td>{$vs.id}</td>
                                        <td>{$vs.html}{$vs.title}</td>
                                        <td>{$vs.name}</td>
                                        <td>
                                            <if condition="($vs.status eq 1)">
                                                <a href="javascript:Alterstate({$vs.id})" id="state{$vs.id}" class="label label-primary">正常</a>
                                            <else/>
                                                <a href="javascript:Alterstate({$vs.id})" id="state{$vs.id}" class="label label-danger">禁用</a>
                                            </if>
                                        </td>
                                        <td>{$vs.addtime}</td>
                                        <td>{$vs.sort}</td>
                                        <td>
                                            <a href="{:U('Rule/add?pid='.$vs['id'])}" class="label label-primary"><i class="fa fa-plus-square-o"></i>&nbsp;添加子权限</a>&nbsp;&nbsp;&nbsp;&nbsp;
                                            <a href="{:U('Rule/edit?id='.$vs['id'])}" class="label label-primary"><i class="fa fa-edit"></i>&nbsp;修改</a>
                                            &nbsp;&nbsp;&nbsp;&nbsp;
                                            <a href="javascript:del({$vs.id});" class="label label-danger"><i class="fa fa-trash"></i>&nbsp;删除</a>
                                        </td>
                                    </tr>   
                                </volist>
                                </tbody>
                        	</table>                        
                    </div>
                 
                </div>
            </div>
        </div>

    </div>
</div>
<script src="__ADMIN__js/jquery.min.js"></script>
<script src="__ADMIN__js/bootstrap.min.js"></script>
<script src="__ADMIN__js/plugins/layer/layer.js"></script>
<script src="__ADMIN__js/plugins/layer/laypage/laypage.js"></script>
<script src="__ADMIN__js/comment.js"></script>
<script>
    //修改状态
    function Alterstate(id){
        var objectState = $('#state'+id);
        /*通过ajax post方法将后台从数据库内查询的情况返回给前台回调函数data代表一个数组通过来判断data.status来判断当前的操作能否成功
        成功后在判断数据中的status的是否正常或者禁用
        */
        comment.status("{:U('Rule/Alterstate')}",id,objectState);
    }
    //删除是通过id来操作的
    function del(id){
        comment.del("{:U('Rule/del')}",id,"{:U('Rule/index')}");  
    }
   
</script>
</body>
</html>